<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

class mostdownload  extends widgets{
    //put your code here
    public function __construct() {
        parent::widgets();
    }
    
    function run($condition = array(), $limit = 10){
		$data =array();
		$data['mostdownloads'] = $this->gets($condition, $limit);
        return $this->build('mostdownload',$data);
    }
	
	function gets($condition = array(), $limit = 10) {
		$this->load->model("msoft");
		$this->db->select("SOFT_ID,SOFT_NAME, SOFT_CODE,SOFT_VERSION,SOFT_THUMB,SOFT_DOWN,SOFT_CACHE_MAN,SOFT_CACHE_CATEGORY,SOFT_CACHE_LICENSE,SOFT_CACHE_IMAGES");
		if($limit >0)
			$this->db->limit($limit);
		if($condition != array())
			$this->db->where($condition);
		$this->db->order_by("SOFT_DOWN desc");	
		return $this->msoft->getsSoft();
	}
}

?>
